
<%-- 
    Document   : todasReservas
    Created on : 12/10/2011, 20:16:28
    Author     : Neto
--%>
<%@page import="model.Reserva, model.Usuario"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.List, java.util.Iterator, javax.servlet.http.HttpSession;"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>LISTAGEM DE TODAS AS RESERVAS FEITAS</title>
    </head>
    <body>
         <jsp:include page="topoadmin.jsp"/>
         <jsp:useBean id="reserva" class="model.Reserva" scope="session"></jsp:useBean>
         <jsp:useBean id="usuario" class="model.Usuario" scope="session"></jsp:useBean>
         <jsp:useBean id="voo" class="model.Voo" scope="session"></jsp:useBean>
    <body>
        <%
            HttpSession sessao = request.getSession(true);
            try {
                Usuario usuarioAdmin = (Usuario) sessao.getAttribute("admin");
                if(usuario.getCpf() == null){
                    response.sendRedirect("login.jsp");
                }else if(usuarioAdmin.getLogin().equals("admin") && usuarioAdmin.getSenha().equals("admin")){
                    
        %>

        <div id="content">
            <br><br>
             <table style="text-align: left; width: 80%;" border="1" cellpadding="2" cellspacing="2" align="center">
            <tbody>
                <tr>
                    <td style="vertical-align: top; text-align: center;"><b>ID do usuario</b></td>
                    <td style="vertical-align: top; text-align: center;"><b>Numero da Reserva</b></td>
                     <%--<td style="vertical-align: top; text-align: center;"><b>Ver dados da Reserva</b></td>--%>
                     <td style="vertical-align: top; text-align: center;"><b>Excluir Reservas</b></td>
                </tr>
                <%
                    List reservas = (List)request.getAttribute("todasReservas");
                    for (Iterator i = reservas.iterator(); i.hasNext();){
                    Reserva r= (Reserva)i.next();
                %>
                <tr>
                    <td style="vertical-align: top; text-align: center;"><%= r.getIdUser() %></td>
                    <td style="vertical-align: top; text-align: center;"><%= r.getNumVooReserva() %></td>
                    <%--<td style="vertical-align: top; text-align: center;">
                        <a href="controlador?cmd=dadosReserva&idUser=<%= r.getIdUser() %>&numVooReserva=<%= r.getNumVooReserva() %>"> clique </a>
                    </td>--%>
                    <td style="vertical-align: top; text-align: center;">
                        <a href="controlador?cmd=excluirReserva&numVooReserva=<%= r.getNumVooReserva()%>&idUser=<%= r.getIdUser() %>">Excluir</a>
                    </td>
                </tr>
                <%
                            }
                %>

            </tbody>
        </table>
        </div>
 <%
                }
            } catch (Exception e) {
                e.printStackTrace();
                response.sendRedirect("login.jsp");
            }

        %>
    </body>
    <jsp:include page="rodape.jsp"/>
        
    </body>
</html>
